<?php
class Model_Init{
	
	public function __construct() {
		$user_is_sign = Zend_Auth::getInstance ()->hasIdentity ();
		$controller = Zend_Controller_Front::getInstance()->getRequest ()->getControllerName ();
		
		//check if user is sign in
		if (! $user_is_sign && $controller != 'index' && $controller != 'user' && $controller != 'lang' ) {
			
			$redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
			$redirector->gotoSimple('index','index');
		}
		
		if ($user_is_sign) {
			$user_id = Zend_Auth::getInstance ()->getIdentity ()->id;
			$model_user = new Model_User ( $user_id );
			$model_user->setActivity ();
		}
	}

}